﻿using lazada.Models;
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using System.Web;

namespace lazada.DAL
{
    public class ListDAL:ConnectionDB
    {
        public ListDAL(): base()
        {

        }

        public List<ListModel> ListKM()
        {
            List<ListModel> list = new List<ListModel>();
            SqlCommand command = new SqlCommand();
            command.CommandText = "select * from KMLAZADA";
            command.Connection = Connection;
            SqlDataReader dr;
            dr = command.ExecuteReader();
            while(dr.Read())
            {
                ListModel lis = new ListModel();

                lis.listleft = dr["Name"].ToString();

                list.Add(lis);
            }
            Connection.Close();
            return list;
        }

        public List<ListModel> ListSKSD()
        {
            List<ListModel> list = new List<ListModel>();
            SqlCommand command = new SqlCommand();
            command.CommandText = "select * from SKSD";
            command.Connection = Connection;
            SqlDataReader dr;
            dr = command.ExecuteReader();
            while (dr.Read())
            {
                ListModel lis = new ListModel();

                lis.listleft = dr["Name"].ToString();

                list.Add(lis);
            }
            Connection.Close();
            return list;
        }

        public List<ListModel> ListTRTX()
        {
            List<ListModel> list = new List<ListModel>();
            SqlCommand command = new SqlCommand();
            command.CommandText = "select * from TRTX";
            command.Connection = Connection;
            SqlDataReader dr;
            dr = command.ExecuteReader();
            while (dr.Read())
            {
                ListModel lis = new ListModel();

                lis.listleft = dr["Name"].ToString();

                list.Add(lis);
            }
            Connection.Close();
            return list;
        }

        public List<ListModel> ListMB()
        {
            List<ListModel> list = new List<ListModel>();
            SqlCommand command = new SqlCommand();
            command.CommandText = "select * from MB";
            command.Connection = Connection;
            SqlDataReader dr;
            dr = command.ExecuteReader();
            while (dr.Read())
            {
                ListModel lis = new ListModel();

                lis.listleft = dr["Name"].ToString();

                list.Add(lis);
            }
            Connection.Close();
            return list;
        }

        public List<ListModel> ListDHMK()
        {
            List<ListModel> list = new List<ListModel>();
            SqlCommand command = new SqlCommand();
            command.CommandText = "select * from DHMK";
            command.Connection = Connection;
            SqlDataReader dr;
            dr = command.ExecuteReader();
            while (dr.Read())
            {
                ListModel lis = new ListModel();

                lis.listleft = dr["Name"].ToString();

                list.Add(lis);
            }
            Connection.Close();
            return list;
        }

        public List<ListModel> ListVOUCHERS()
        {
            List<ListModel> list = new List<ListModel>();
            SqlCommand command = new SqlCommand();
            command.CommandText = "select * from VOUCHERS";
            command.Connection = Connection;
            SqlDataReader dr;
            dr = command.ExecuteReader();
            while (dr.Read())
            {
                ListModel lis = new ListModel();

                lis.listleft = dr["Name"].ToString();

                list.Add(lis);
            }
            Connection.Close();
            return list;
        }
        public List<ListModel> ListTTDN()
        {
            List<ListModel> list = new List<ListModel>();
            SqlCommand command = new SqlCommand();
            command.CommandText = "select * from TTDN";
            command.Connection = Connection;
            SqlDataReader dr;
            dr = command.ExecuteReader();
            while (dr.Read())
            {
                ListModel lis = new ListModel();

                lis.listleft = dr["Name"].ToString();

                list.Add(lis);
            }
            Connection.Close();
            return list;
        }
        public List<ListModel> ListDOGD()
        {
            List<ListModel> list = new List<ListModel>();
            SqlCommand command = new SqlCommand();
            command.CommandText = "select * from DOGD";
            command.Connection = Connection;
            SqlDataReader dr;
            dr = command.ExecuteReader();
            while (dr.Read())
            {
                ListModel lis = new ListModel();

                lis.listleft = dr["Name"].ToString();

                list.Add(lis);
            }
            Connection.Close();
            return list;
        }
        public List<ListModel> ListNCDS()
        {
            List<ListModel> list = new List<ListModel>();
            SqlCommand command = new SqlCommand();
            command.CommandText = "select * from NCDS";
            command.Connection = Connection;
            SqlDataReader dr;
            dr = command.ExecuteReader();
            while (dr.Read())
            {
                ListModel lis = new ListModel();

                lis.listleft = dr["Name"].ToString();

                list.Add(lis);
            }
            Connection.Close();
            return list;
        }
        public List<ListModel> ListTABLET()
        {
            List<ListModel> list = new List<ListModel>();
            SqlCommand command = new SqlCommand();
            command.CommandText = "select * from TABLET";
            command.Connection = Connection;
            SqlDataReader dr;
            dr = command.ExecuteReader();
            while (dr.Read())
            {
                ListModel lis = new ListModel();

                lis.listleft = dr["Name"].ToString();

                list.Add(lis);
            }
            Connection.Close();
            return list;
        }

        public List<ListModel> ListLAPTOP()
        {
            List<ListModel> list = new List<ListModel>();
            SqlCommand command = new SqlCommand();
            command.CommandText = "select * from LAPTOP";
            command.Connection = Connection;
            SqlDataReader dr;
            dr = command.ExecuteReader();
            while (dr.Read())
            {
                ListModel lis = new ListModel();

                lis.listleft = dr["Name"].ToString();

                list.Add(lis);
            }
            Connection.Close();
            return list;
        }

        public List<ListModel> ListTV()
        {
            List<ListModel> list = new List<ListModel>();
            SqlCommand command = new SqlCommand();
            command.CommandText = "select * from TV";
            command.Connection = Connection;
            SqlDataReader dr;
            dr = command.ExecuteReader();
            while (dr.Read())
            {
                ListModel lis = new ListModel();

                lis.listleft = dr["Name"].ToString();

                list.Add(lis);
            }
            Connection.Close();
            return list;
        }
       
        public List<ListModel> ListCAMERA()
        {
            List<ListModel> list = new List<ListModel>();
            SqlCommand command = new SqlCommand();
            command.CommandText = "select * from CAMERA";
            command.Connection = Connection;
            SqlDataReader dr;
            dr = command.ExecuteReader();
            while (dr.Read())
            {
                ListModel lis = new ListModel();

                lis.listleft = dr["Name"].ToString();

                list.Add(lis);
            }
            Connection.Close();
            return list;
        }
        public List<ListModel> ListOTO()
        {
            List<ListModel> list = new List<ListModel>();
            SqlCommand command = new SqlCommand();
            command.CommandText = "select * from OTO";
            command.Connection = Connection;
            SqlDataReader dr;
            dr = command.ExecuteReader();
            while (dr.Read())
            {
                ListModel lis = new ListModel();

                lis.listleft = dr["Name"].ToString();

                list.Add(lis);
            }
            Connection.Close();
            return list;
        }
    }
}